<?php

declare(strict_types=1);

namespace App\Aspect;

use App\Controller\IndexController;
use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Logger\LoggerFactory;
use Psr\Container\ContainerInterface;
use Hyperf\Di\Aop\ProceedingJoinPoint;

/**
 * @Aspect
 */
class FooAspect extends AbstractAspect
{
    protected $container;
    protected $logger;

    public $classes = [
        IndexController::class,
    ];

    public function __construct(ContainerInterface $container,LoggerFactory $loggerFactory)
    {
        $this->container = $container;
        $this->logger = $loggerFactory->get('hyperf', 'default');

    }

    public function process(ProceedingJoinPoint $proceedingJoinPoint)
    {

        $this->logger->info('in foo aspect');
        echo "I am in FootAspect\n";

        return $proceedingJoinPoint->process();
    }
}
